<!DOCTYPE html>
<html lang="en">
<head>
	<title>${blogger.fullName} - @${blogger.username} Instagram Analytics | GugeeData</title>
	<meta name="viewport"
	      content="width=device-width, initial-scale=1.0, user-scalable=0, minimum-scale=1.0, maximum-scale=1.0">
	<meta name="description" content="Let's check out ${blogger.fullName} Instagram analytics report on GugueeData.">
	<meta name="keywords"
	      content="${blogger.fullName}, @${blogger.username}, Creator of Instagram, Instagram Analytics">
	<meta property="og:title" content="${blogger.fullName} - @${blogger.username} Instagram Analytics | GugeeData">
	<meta property="og:description"
	      content="Let's check out ${blogger.fullName} Instagram analytics report on GugueeData.">
	<meta property="og:type" content="website">
	<meta property="og:url" content="https://www.gugeedata.com/instagram/${blogger.username}">
	<meta property="og:image" content=" https://seo-imags.s3.us-east-2.amazonaws.com/Logo.png">
	<meta name="twitter:title" content="${blogger.fullName} - @${blogger.username} Instagram Analytics | GugeeDataa">
	<meta name="twitter:description"
	      content="Let's check out ${blogger.fullName} Instagram analytics report on GugueeData.">

	<link rel="icon" href="${request.contextPath}/static/img/favicon.ico" type="image/x-icon"/>
	<link rel="shortcut icon" href="${request.contextPath}/static/img/favicon.ico" type="image/x-icon"/>

	<link rel="stylesheet" href="${request.contextPath}/static/css/ins/common.css">
	<link rel="stylesheet" href="${request.contextPath}/static/css/ins/influencer.css">
    <#include "../../component/facebookPixel.ftl">
</head>
<body>
<#include "../../header_new1.ftl">
<main>
	<section>
		<div class="container">
			<h1>${blogger.fullName} Instagram Analytics</h1>
			<h2>Check out ${blogger.fullName} Instagram analytics report.</h2>
			<div class="update-time">
                <#setting datetime_format="MM-dd-yyyy HH:mm"/>
				Data Updated: ${(blogger.lastCollectTime*1000)?number_to_datetime}
			</div>
			<div class="user-info">
				<div class="user-detail">
					<div class="left">
						<div class="user-basic">
							<div class="avatar">
                                <#assign picUrl=numberFormatter.getNoExpiredImage(blogger.picUrl, 0, 0)>
								<img class="user-avatar" src="${picUrl}" alt="${blogger.fullName}">
								<img class="icon" src="${request.contextPath}/static/img/ins/Authentication.png" srcset="${request.contextPath}/static/img/ins/Authentication@2x.png 2x" alt="">
							</div>
							<div class="username">
								<div class="title">
									${blogger.username}
									<#if blogger.categoryName??>
										<div class="category">${blogger.categoryName}</div>
										<#elseif blogger.overallCategoryName??>
										<div class="category">${blogger.overallCategoryName}</div>
									</#if>
								</div>
								<div class="sub-title">
									${blogger.fullName}
								</div>
								<#if blogger.nationName?? && blogger.nationName != ''>
									<div class="address">${blogger.nationName}</div>
								</#if>
							</div>
						</div>
						<#if blogger.biography?? && blogger.biography != ''>
							<div class="user-sign">
								${blogger.biography}
							</div>
						</#if>
					</div>
					<div class="right">
						<div class="user-opt">
							<#if isMobile == false>
                                <#if blogger.publicEmail?? && blogger.publicEmail != ''>
									<div class="gd-popover" content="Contact">
										<div class="icon-mail" onclick="sendEmail()">
											<i class="iconfont iconMail"></i>
										</div>
									</div>
                                </#if>
                                <#if isFavorite == true>
									<div class="gd-popover" content="Remove from Favorite">
										<div class="icon-collect is-collect" onclick="collectUser(this)">
											<i class="iconfont iconquxiaoshoucang33"></i>
										</div>
									</div>
                                <#else>
									<div class="gd-popover" content="Add to Favorite">
										<div class="icon-collect" onclick="collectUser(this)">
											<i class="iconfont iconshoucang"></i>
										</div>
									</div>
                                </#if>
                                <#if isUnlocked == false>
									<div class="gd-popover" content="Unlock">
										<div class="icon-lock" onclick="checkUnlockPermission()">
											<i class="iconfont iconsuoding"></i>
										</div>
									</div>
                                </#if>
								<div class="gd-popover" content="Export to PDF">
									<div class="icon-pdf" onclick="exportPDF()">
										<i class="iconfont iconPDF16px"></i>
									</div>
								</div>
							<#else>
                                <#if blogger.publicEmail?? && blogger.publicEmail != ''>
									<div class="gd-popover">
										<div class="icon-mail" onclick="sendEmail()">
											<i class="iconfont iconMail"></i>
										</div>
									</div>
                                </#if>
                                <#if isFavorite == true>
									<div class="gd-popover">
										<div class="icon-collect is-collect" onclick="collectUser(this)">
											<i class="iconfont iconquxiaoshoucang33"></i>
										</div>
									</div>
                                <#else>
									<div class="gd-popover">
										<div class="icon-collect" onclick="collectUser(this)">
											<i class="iconfont iconshoucang"></i>
										</div>
									</div>
                                </#if>
                                <#if isUnlocked == false>
									<div class="gd-popover">
										<div class="icon-lock" onclick="checkUnlockPermission()">
											<i class="iconfont iconsuoding"></i>
										</div>
									</div>
                                </#if>
								<div class="gd-popover">
									<div class="icon-pdf" onclick="exportPDF()">
										<i class="iconfont iconPDF16px"></i>
									</div>
								</div>
							</#if>
						</div>
						<div class="user-rank">
							<#if rank.worldRank??>
								<div class="rank-item">
									<i class="iconfont iconearth3"></i>
									Global Rank:
									<div class="rank-num">${rank.worldRank}</div>
								</div>
							</#if>
							<#if rank.nationRank??>
								<div class="rank-item">
									<i class="iconfont iconFlag"></i>
									${rank.nation} Rank:
									<div class="rank-num">${rank.nationRank}</div>
								</div>
							</#if>
							<#if rank.categoryRank??>
								<div class="rank-item">
									<i class="iconfont iconIndustry16px"></i>
									${rank.categoryName} Industry:
									<div class="rank-num">${rank.categoryRank}</div>
								</div>
							</#if>
						</div>
					</div>
				</div>
				<div class="user-data">
					<div class="data-title">
						Basic Data
					</div>
					<div class="data-wrap">
						<div class="data-item">
							<div class="title">Followers</div>
                            <#assign followerCount=numberFormatter.getNumber(blogger.followerCount)>
							<div class="sub-title">${followerCount}</div>
						</div>
						<#--<div class="data-item">
							<div class="title">
								Quality Followers
								<div class="gd-popover"
								     content="The estimated quality audience size, excluding suspicious accounts. Suspicious account is determined as account has no follower, no post, or no profile picture. Also, massive following accounts are considered as suspicious.">
									<i class="iconfont iconfaq"></i>
								</div>
							</div>
							<#if blogger.realFollowerCount??>
                                <#assign realFollowerCount=numberFormatter.getNumber(blogger.realFollowerCount)>
								<div class="sub-title">${realFollowerCount}</div>
							<#else>
								<div class="sub-title">-</div>
							</#if>
						</div>-->
						<#--<div class="data-item">
							<div class="title">30-Day Follower Growth</div>
                            <#assign lastFollowerGrow=numberFormatter.getNumber(blogger.lastFollowerGrow)>
							<div class="sub-title">${lastFollowerGrow}</div>
						</div>-->
						<div class="data-item">
							<div class="title">Recent 30-Day Posts</div>
                            <#assign total=numberFormatter.getNumber(media.total)>
							<div class="sub-title">${total}</div>
						</div>
						<div class="data-item">
							<div class="title">
								Avg Views
								<div class="gd-popover"
								     content="Average views on the video media posted in the last 30 days.">
									<i class="iconfont iconfaq"></i>
								</div>
							</div>
                            <#if media.avgVideoViewCount??>
                                <#assign avgVideoViewCount=numberFormatter.getNumber(media.avgVideoViewCount)>
								<div class="sub-title">${avgVideoViewCount}</div>
                            <#else>
								<div class="sub-title">-</div>
                            </#if>
						</div>
						<div class="data-item">
							<div class="title">
								Avg Like
								<div class="gd-popover"
								     content="Average likes on the media posted in the last 30 days.">
									<i class="iconfont iconfaq"></i>
								</div>
							</div>
                            <#if media.avgLike??>
                                <#assign avgLike=numberFormatter.getNumber(media.avgLike)>
								<div class="sub-title">${avgLike}</div>
                            <#else>
								<div class="sub-title">-</div>
                            </#if>
						</div>
						<div class="data-item">
							<div class="title">
								Avg Review
								<div class="gd-popover"
								     content="Average reviews on the media posted in the last 30 days.">
									<i class="iconfont iconfaq"></i>
								</div>
							</div>
                            <#if media.avgComment??>
                                <#assign avgComment=numberFormatter.getNumber(media.avgComment)>
								<div class="sub-title">${avgComment}</div>
                            <#else>
								<div class="sub-title">-</div>
                            </#if>
						</div>
						<div class="data-item">
							<div class="title">
								Avg ER
								<div class="gd-popover"
								     content="Average engagement rates of posts in recent 30-day, Engagement rate = (Likes + Comments) / Followers">
									<i class="iconfont iconfaq"></i>
								</div>
							</div>
							<#if media.avgEr??>
                                <#assign avgEr=numberFormatter.getNumber(media.avgEr)>
								<div class="sub-title">${avgEr}%</div>
							<#else>
								<div class="sub-title">-</div>
							</#if>
						</div>
					</div>
				</div>
			</div>
		</div>
	</section>
	<section>
		<div class="container" <#if isUnlocked == false>style="margin-top: 16px;"</#if>>
			<div class="account-wrap">
				<div class="account-tab">
					<ul>
						<li class="is-active">Overview</li>
						<li>Media</li>
						<li>Audience</li>
						<li>Ads Evaluation</li>
						<li>Product Tagged</li>
					</ul>
				</div>
                <#include "overview.ftl">
                <#include "media.ftl">
                <#include "audience.ftl">
                <#include "ads.ftl">
                <#include "product.ftl">
			</div>
		</div>
	</section>
	<#if login == false>
		<section>
			<div class="container">
				<h3>Highlights of ${blogger.username} Instagram Analytics Report</h3>
				<div class="ana-report">
					<div class="report-item">
						<img width="64" height="64" src="${contextPath}/static/img/ins/card.png" srcset="${contextPath}/static/img/ins/card@2x.png 2x" alt="${blogger.fullName} instagram">
						<h4>Instagram Demographic Analytics</h4>
						<p>Sign in and unlock the full report to check ${blogger.username} audience demographics analytics which includes geographics of top 5 countries and cities, gender & age splits, top 5 languages used as well as the ethnicity distribution.</p>
					</div>
					<div class="report-item">
						<img width="64" height="64" src="${contextPath}/static/img/ins/star.png" srcset="${contextPath}/static/img/ins/star@2x.png 2x" alt="${blogger.fullName} instagram">
						<h4>Instagram Audience Quality Analytics</h4>
						<p>Using AI-Driven technology to detect ${blogger.username} fake followers, the report shows the size of quality audience, reflecting the true reachability of the accounts and excluding the fake follower fraud possibility.</p>
					</div>
					<div class="report-item">
						<img width="64" height="64" src="${contextPath}/static/img/ins/imagine.png" srcset="${contextPath}/static/img/ins/imagine@2x.png 2x" alt="${blogger.fullName} instagram">
						<h4>Instagram Audience Interest Analytics</h4>
						<p>The big-data analytics on audience, listed the ${blogger.username} audience interested top 20 industries and top 20 brands, guide the brand vendors to find the right influencers for their marketing campaign.</p>
					</div>
				</div>
			</div>
		</section>
		<section class="faqs">
			<div class="container">
				<h3>FAQs on ${blogger.username} Instagram Analytics</h3>
				<p class="sub-title">If you have any questions regarding ${blogger.fullName}'s Instagram account information, account stats like engagement rate, number of followers, follower growth etc, find the following frequently asked questions about ${blogger.username} Instagram account and the Instagram analytics report on Gugee Data.</p>
				<div class="gd-collapse">
					<div class="gd-collapse-item is-collapse">
						<div class="gd-collapse-item__title">
							<div class="gd-collapse-item__label">How can I access to ${blogger.fullName}'s Instagram statistics?</div>
							<div class="gd-collapse-item__affix">
								<i class="iconfont iconchevron-up-16px"></i>
							</div>
						</div>
						<div class="gd-collapse-item__wrap">
                            ${blogger.username} Instagram statistics are available on Gugee Data Instagram analytics report. Log in and lock the report for full information of ${blogger.username}.
						</div>
					</div>
					<div class="gd-collapse-item is-collapse">
						<div class="gd-collapse-item__title">
							<div class="gd-collapse-item__label">
								Instagram Analytics: How many followers does ${blogger.fullName} have on Instagram?
							</div>
							<div class="gd-collapse-item__affix">
								<i class="iconfont iconchevron-up-16px"></i>
							</div>
						</div>
						<div class="gd-collapse-item__wrap">
                            ${blogger.fullName} has ${followerCount} on Instagram.
						</div>
					</div>
					<div class="gd-collapse-item is-collapse">
						<div class="gd-collapse-item__title">
							<div class="gd-collapse-item__label">Instagram Analytics: What is the average engagement rate of ${blogger.fullName}'s Instagram account?</div>
							<div class="gd-collapse-item__affix">
								<i class="iconfont iconchevron-up-16px"></i>
							</div>
						</div>
						<div class="gd-collapse-item__wrap">
                            <#--					30天平均参与率-->
							The 30-day average engagement rate of ${blogger.username} Instagram account is ${avgEr!'-'}%. Check this metric on Gugee Data to see how other similar accounts perform.
						</div>
					</div>
					<div class="gd-collapse-item is-collapse">
						<div class="gd-collapse-item__title">
							<div class="gd-collapse-item__label">
								Instagram Analytics: What is the average likes on ${blogger.fullName}'s Instagram account?
							</div>
							<div class="gd-collapse-item__affix">
								<i class="iconfont iconchevron-up-16px"></i>
							</div>
						</div>
						<div class="gd-collapse-item__wrap">
                            <#--					平均点赞数-->
                            ${blogger.username} Instagram on average has ${followerCount} likes. The number is calculated based on ${blogger.username} recent 30-day posts. To see her ranking within same account tier, please log in and unlock the report.
						</div>
					</div>
					<div class="gd-collapse-item is-collapse">
						<div class="gd-collapse-item__title">
							<div class="gd-collapse-item__label">
								What information can I access to on Gugee Data Instagram ${blogger.fullName} analytics report?
							</div>
							<div class="gd-collapse-item__affix">
								<i class="iconfont iconchevron-up-16px"></i>
							</div>
						</div>
						<div class="gd-collapse-item__wrap">
							The Instagram analytics report indicates the in-depth analysis of influencers in the perspectives of growth trends, audience quality, audience demographics and ads evaluation. Moreover, it also compare the metrics within the same account tier to evaluate the competitive advantage for each Instagram account. This way, brand vendors are able to find the right influencer for their marketing campaign.
						</div>
					</div>
				</div>
			</div>
		</section>
	</#if>
</main>
<#if isMobile == false>
    <#include "../../footer_new.ftl">
</#if>
<script src="${request.contextPath}/static/js/gd-ui/collapse/index.js"></script>
<script src="${request.contextPath}/static/js/gd-ui/popover/index.js"></script>
<script src="${request.contextPath}/static/js/gd-ui/button/group.js"></script>
<script src="${request.contextPath}/static/plugins/html2canvas.min.js"></script>
<script src="${request.contextPath}/static/plugins/jspdf.min.js"></script>
<script>
    function checkUnlockPermission() {
        <#if login == false>
        return toLogin()
        </#if>
        showLoading()
        _axios.get('/ins/blogger/report/unlock/checked').then(res => {
            if (res.Code === 200) {
                let extra = ''
                let isShowAgain = !localStorage.getItem('isShowAgain')
                if (res.Data) {
                    if (res.Data.type === 1) {
                        if (isShowAgain) {
                            extra = '<div class="tips"><input type="checkbox"/><span>Do not show this message again.</span></div>'
                        } else {
                            unlockReport()
                            return false
                        }
                    }
                    showModal({
                        content: res.Msg + extra,
                        confirmBtn: {
                            event: this.unlockReport.bind(this, res.Data.type)
                        }
                    })
                } else {
                    window.location.href = '/pricing'
                }
            } else {
                showToast(res.Msg)
            }
            hideLoading()
        })
	    return true
    }
    function unlockReport(type) {
        showLoading()
		visitRecord(26)
        if (type === 1) {
            let checkbox = document.querySelector('.modal input')
            if (checkbox.checked) {
                localStorage.setItem('isShowAgain', 1)
            } else {
                localStorage.removeItem('isShowAgain')
            }
        }
        _axios.post('/ins/blogger/report/unlock', {
            uid: '${blogger.uid?c}'
        }).then(res => {
            if (res.Code === 200) {
                window.location.reload()
            } else {
                hideLoading()
            }
            closeModal()
        })
    }
    function sendEmail() {
        <#if isUnlocked == false>
	        checkUnlockPermission()
	        return false
        </#if>
		visitRecord(30)
        window.location.href="mailto:${blogger.publicEmail!''}"
    }
	function exportPDF() {
        <#if isUnlocked == false>
	        checkUnlockPermission()
	        return false
        </#if>

	    showLoading()
		visitRecord(25)
        const element = document.querySelector('main')
		if(!gugeeGobal.isMobile) {
            element.style.width = '1200px'
            element.style.margin = 'auto'
		}
		setTimeout(() => {
            html2canvas(element, {
                // allowTaint: true,
                logging: true,
                useCORS: true
            }).then(function (canvas) {
                const { jsPDF } = window.jspdf
                const pdf = new jsPDF('p', 'mm', 'a4') // A4纸，纵向
                let ctx = canvas.getContext('2d')
                let a4w = 190
                let a4h = 257 // A4大小，210mm x 297mm，四边各保留20mm的边距，显示区域170x257
                let imgHeight = Math.floor(a4h * canvas.width / a4w) // 按A4显示比例换算一页图像的像素高度
                let renderedHeight = 0

                while (renderedHeight < canvas.height) {
                    let page = document.createElement('canvas')
                    page.width = canvas.width
                    page.height = Math.min(imgHeight, canvas.height - renderedHeight)// 可能内容不足一页

                    // 用getImageData剪裁指定区域，并画到前面创建的canvas对象中
                    page.getContext('2d').putImageData(ctx.getImageData(0, renderedHeight, canvas.width, Math.min(imgHeight, canvas.height - renderedHeight)), 0, 0)
                    pdf.addImage(page.toDataURL('image/png', 1.0), 'JPEG', 10, 10, a4w, Math.min(a4h, a4w * page.height / page.width)) // 添加图像到页面，保留10mm边距

                    renderedHeight += imgHeight
                    if (renderedHeight < canvas.height) { pdf.addPage() }// 如果后面还有内容，添加一个空页
                    // delete page;
                }
                pdf.save('${blogger.fullName?js_string} Instagram Analytics.pdf')
                element.removeAttribute('style')
                hideLoading()
            })
		}, 1500)

	}
	let isCollect = ${isFavorite?c}
    let collectId = ${favoriteId}
	function collectUser(ele) {
	    if(!gugeeGobal.isLogin) {
            toLogin()
            return false
	    }
        ele.showLoading()
		const popoverEle = ele.parentElement
        if(isCollect) {
            isCollect = false
            _axios.delete('/ins/fa/blogger', {
                data: {
                    collectId: collectId
                }
            }).then(res => {
                if(res.Code === 200) {
                    ele.classList.remove('is-collect')
                    ele.querySelector('.iconfont').className = 'iconfont iconshoucang'
                    if(!gugeeGobal.isMobile) {
                        popoverEle.setAttribute('content', 'Add to Favorite')
                        initPopover(popoverEle)
                    }
                }
                ele.hideLoading()
            })
        } else {
            isCollect = true
            _axios.post('/ins/fa/blogger', {
                uid: '${blogger.uid?c}'
            }).then(res => {
                if(res.Code === 200) {
                    collectId = res.Data.collectId
                    ele.classList.add('is-collect')
                    ele.querySelector('.iconfont').className = 'iconfont iconquxiaoshoucang33'
                    if(!gugeeGobal.isMobile) {
                        popoverEle.setAttribute('content', 'Remove from Favorite')
                        initPopover(popoverEle)
                    }
                }
                ele.hideLoading()
            })
        }
	}
</script>
<script type="module">
	import { troggleActive } from "/static/js/common.js"

    initEvent()

	function initEvent() {
	    const tabs = document.querySelectorAll('.account-wrap .account-tab li')
		let firstLoad = []
        tabs && tabs.forEach((item, i) => {
            item.addEventListener('click', () => {
                changeAccountTab(item, i)
                if(i !== 0 && !firstLoad.includes(i)) {
					firstLoad.push(i)
                    <#if isUnlocked == true>
                    switch (i) {
                        case 2:
                            echarts.getInstanceByDom(ageGenderSplitTrend).resize()
                            echarts.getInstanceByDom(ethnicityEle).resize()
                            echarts.getInstanceByDom(incomeEle).resize()
                            echarts.getInstanceByDom(activeTimeHourEle).resize()
                            echarts.getInstanceByDom(activeTimeDayEle).resize()
                            break
                    }
                    </#if>
				}
            })
        })

		if(gugeeGobal.isLogin) {
            document.querySelectorAll('.lock-tips .btn-default').forEach(item => {
	            item.addEventListener('click', () => {
	                checkUnlockPermission()
	            })
            })
			document.querySelectorAll('.lock-tips .btn-info').forEach(item => {
			    item.addEventListener('click', () => {
			        window.location.href = '/pricing'
			    })
			})
		} else {
            document.querySelectorAll('.lock-tips .gd-btn').forEach(item => {
                item.addEventListener('click', () => {
                    toLogin()
                })
            })
		}
	}

    function changeAccountTab(element, index) {
        troggleActive(element, () => {
            if(element.innerText === 'Audience') {
				visitRecord(28)
            } else if(element.innerText === 'Ads Evaluation') {
				visitRecord(29)
            } else {
				visitRecord(27)
            }

            //scroll 定位
            const scrollWrap = document.querySelector('.account-tab ul')
            //判断滑动内容和屏幕宽度的大小，40为padding
            if(scrollWrap.scrollWidth > (document.body.offsetWidth - 40)) {
                // padding-left: 20  margin-right: 35
                const position = element.offsetLeft - (20 + 35) - element.clientWidth / 2
                scrollWrap.scrollTo(position, 0)
            }
            //滑动到内容顶部
            const accountWrap = document.querySelector('.account-wrap')
            const accountWrapTop = getElementPosition(accountWrap).top - 60
            if(getScroll().top > accountWrapTop) {
                window.scrollTo(0, accountWrapTop)
            }

            //内容显示隐藏
            const tabWraps = document.querySelectorAll('.account-wrap > .tab-wrap')
            tabWraps.forEach(item => {
                item.hide()
            })
            tabWraps[index].show()
        })
    }
</script>
</body>
</html>
